<?php
/*
 * File User.php for project Rijlesplanner.nl
 * Created on 19 nov 2007 at 20:14:17 by Ivar Pruijn
 */

class User {
  
	// Properties:
	private $username = "";
	public $usertype = 0;
	private $acl = array();

	// Methods:

	/**
	 * void __construct ()
	 * This is the constructor method for the User class.
	 */
	public function __construct() {
   	}
   	
   	public function User(array $atts=NULL) {
		$this->ConstructFromArray($atts);
	}
	
	public function getUserName() {
	  return $this->username;
	}

	public function getPassword() {
	  return $this->password;
	}

	public function getEmail() {
	  return $this->email;
	}

	public function getUserType() {
	  return $this->usertype;
	}
	
	public function getACL($module="") {
		if(empty($module)) {
			return $this->acl;
		} else {
			return $this->acl[$module];
		}
	}
	
	public function setACL($newVal = array()) {
		$this->acl = $newVal;
	}
	
	public function setUsername($username) {
		$this->username = $username;
	}

	/**
	 * void ConstructFromArray ([array attributes])
	 * This method, if an array is given as the argument, will
	 * create properties in the current object named after the
	 * keys of the array, and set the properties to the corresponding
	 * values from the array.
	 */
	private function ConstructFromArray (array $atts=NULL) {
		if (is_array($atts)) {
			while (list($key, $value) = each($atts)) {
				$this->$key = $value;
			}
		}
	}

	public function __destruct() {
//		global $logger;
//    	$logger->log("Destroying user " . $this->__toString() . "!\n",PEAR_LOG_INFO);
   	}
   	
   	public function __toString() {
        return $this->username;
    }

}

?>